package com.hrp.controller;

import com.hrp.domain.Jxksgsmb;
import com.hrp.domain.ResponseData;
import com.hrp.service.JxksgsmbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/8/11 0011.
 */
@RestController
@RequestMapping("jxksgsmb")
public class JxksgsmbController {

    @Autowired
    private JxksgsmbService jxksgsmbService;


    @RequestMapping("/updateGsmb")
    public String updateGsmb(String gsmb,String jxksdm,String jxksmc,String gsmcHtml){
        jxksgsmbService.updateGsmb(gsmb,jxksdm,jxksmc,gsmcHtml);
        return "成功";
    }

    @RequestMapping("/getJxksgsmb")
    public ResponseData getJxksgsmb(String jxksdm){
        try{
            Jxksgsmb jxksgsmb = jxksgsmbService.getJxksgsmbByJxksdm(jxksdm);
            if(jxksgsmb==null){
                return ResponseData.build(200,"获取数据成功","");
            }else{
                return ResponseData.build(200,"获取数据成功",jxksgsmb.getGsmcHtml());
            }
        }catch (Exception e){
            return ResponseData.build(500,"获取数据失败","");
        }
    }

}
